    ; this program is design by eng:motee malazee syria latakia tel 0096341933730376:E.mail
    ; motee.z222@yahoo.com
    ;you can draw the spiral curve(clothiod)
    ;using 2 intersection lines if 2 branch or existing circle with near line for 1 branch
    ;give speed of vehical got minimum radius due to this speed
    ; then suggest 2 length one of them due to mininmum radius the other to make 2 branch
    ; connected
    ; together without simple
    ; curve
    ; if maximum length smaller than minimum length due to angle between the 2 lines then you have
    ; to
    ; increase
    ; radius
    ;QinDong 2023-11-30
(setq times_hh 0)

(defun c:zzhhqx	 (/ lca lcal r0 l0 x0 y0 angcg lc s)
    ;第一次运行显示提示信息
    (if	(= 0 times_hh)
	(progn
	    (alert
		(strcat
		    "             缓和曲线绘制程序-zzhhqx ver:2023.01\n\n"
		    "1、模式一：直线、平曲线间绘连接缓和曲线；\n"
		    "2、模式二：交点上绘缓、圆、缓。\n\n"
		    "注意：速度不得大于道路设计速度，不确定时请输入较小的值\n\n"
		    "微博\\抖音\\CSDN:测量老覃  www.cehui.ren  qinxyz@email.cn \n")
		)
	    (setq times_hh 1)
	    ) ;end progn

	) ;endif

    ; (command "._undo" "_BE")
    (setq clyr (getvar "clayer"))
    (if	(null txth)
	(setq txth 1.25)
	)
    (setq txthnew
	     (getreal
		 (strcat
		     "\n 请输入标注文字高度：2.5(1:1000)、1.25(1:500)、"
		     "<"
		     (rtos txth 2 2)
		     ">(1:200)"
		     )
		 )
	  )
    (if	txthnew
	(setq txth txthnew)
	)
    (initget "1 2")
    (setq br (getkword
		 "\n 输入: 1-由平曲线和直线绘单一缓和曲线；2-由切线交点半径缓和曲线长绘缓、圆、缓。<2>"
		 )
	  )
    (if	(not br)
	(progn
	    (setq br "2")
	    )
	)
    (if	(= br "2")
	(progn
	    (setq p1 (getpoint "\n 请拾取第一切线上任意一点！")
		  pc (getpoint "\n 请拾取交点！")
		  p2 (getpoint "\n 请在第2切线边上拾取第3点！")
		  )
	    (setq obm (getvar "blipmode"))
	    (setq osmd (getvar "osmode"))
	    (setvar "osmode" 0)
	    (setq andr (getvar "angdir"))
	    (setvar "angdir" 1)
	    (setq andb (getvar "angbase"))
	    (setvar "angbase" (/ pi 2))
	    (setq aunt (getvar "aunits"))
	    (setvar "aunits" 0)
	    (setvar "dimaunit" 1)
	    (setvar "dimadec" 4)
	    (setq clyr (getvar "clayer"))
	    (setq ang1 (angle pc p1)
		  ang2 (angle pc p2)
		  ang  (- ang1 ang2)
		  ang0 (abs ang)
		  )
	    (if	(<= ang0 pi)
		(setq ar (- pi ang0))
		(setq ar (- ang0 pi))
		)
	    (setq a (/ (* 180 ar) pi)) ;200 QinDong
	    (setq speed (getreal "\n 请输入设计速度(km//h) ="))
	    (setq speed (float speed))
	    (setq acradi (* 0.035 (expt speed 2)))
	    (if	(null r0)
		(setq r0 acradi)
		)
	    (setq r0new	(getreal (strcat "\n 请输入平曲线半径"
					 ">"
					 "="
					 (rtos acradi 2 4)
					 )
				 )
		  )
	    (if	(null r0new)
		(setq r0new acradi)
		)
	    (if	r0new
		(setq r0 r0new)
		)
;;;;;;;;;;;;;;;;;;;;;lllllllllllllllllllllllllllllllllllllllllllllll
	    (setq lca (/ (expt (* 0.207 (sqrt (expt speed 3))) 2) r0))
	    (setq lcal (/ (* a r0 pi) 180));200->180 QinDong
	    (while (if (< lcal lca)
		       (progn
			   (alert "请增大半径数值")
			   (setq r0 (getreal "\n 请重新输入半径数值> "))
			   (setq lca (/ (expt (* 0.207 (sqrt (expt speed 3))) 2) r0))
			   (setq lcal (/ (* a r0 pi) 180));200->180 QinDong
			   )
		       )
	     )

    ;ppppppppppppppppppp
	    (setq l0 (getreal
			 (strcat "\n 缓和曲线长必须大于 "
				 (rtos lca 2 4)
				 " 且小于 "
				 (rtos lcal 2 4)
				 " 按回车取最大值"
				 )
			 )
		  )
	    (if	(not l0)
		(setq l0 lcal)
		)

	    (setq u (/ l0 (* 2 r0)))
	    (setq t0 (/ (* 180 u) pi));200->180 QinDong
	    (princ "T0=")
	    (setq i (sqrt (* 2 (* l0 r0))))
	    (princ t0)
;;;;;;;;;;
	    (setq ptlst '())
	    (setq sn 2.0)
	    (setq k 1.0)
	    (setq n (/ L0 sn))
	    (while (<= k n)
;;;;;;;;;;;;;;;;
		(progn
		    (setq ln (* k sn))
		    (setq v (/ (expt ln 2) (expt i 2)))
		    (setq v1  (expt v 0.5)
			  v2  (/ (expt v 2.5) 10)
			  v3  (/ (expt v 4.5) 216)
			  v4  (/ (expt v 6.5) 9360)
			  v5  (/ (expt v 8.5) 685440)
			  v6  (/ (expt v 10.5) 76204800)
			  v7  (/ (expt v 1.5) 3)
			  v8  (/ (expt v 3.5) 42)
			  v9  (/ (expt v 5.5) 1320)
			  v10 (/ (expt v 7.5) 80640)
			  v11 (/ (expt v 9.5) 6894720)
			  )
		    (setq xn (* i (- (+ (- (+ (- v1 v2) v3) v4) v5) v6)))
		    (setq yn (* i (+ (- (+ (- v7 v8) v9) v10) v11)))
		    (setq pnx (list xn yn))
		    (setq ptlst (cons pnx ptlst))

		    (setq k (+ 1 k))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
		    )
		)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	    (setq ln l0)
	    (setq v (/ (expt l0 2) (expt i 2)))
	    (setq v1  (expt v 0.5)
		  v2  (/ (expt v 2.5) 10)
		  v3  (/ (expt v 4.5) 216)
		  v4  (/ (expt v 6.5) 9360)
		  v5  (/ (expt v 8.5) 685440)
		  v6  (/ (expt v 10.5) 76204800)
		  v7  (/ (expt v 1.5) 3)
		  v8  (/ (expt v 3.5) 42)
		  v9  (/ (expt v 5.5) 1320)
		  v10 (/ (expt v 7.5) 80640)
		  v11 (/ (expt v 9.5) 6894720)
		  )
	    (setq xend (* i (- (+ (- (+ (- v1 v2) v3) v4) v5) v6)))
	    (setq yend (* i (+ (- (+ (- v7 v8) v9) v10) v11)))
	    (setq pend (list xend yend))
	    (setq ptlst (cons pend ptlst))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	    (setq pstart (list 0 0))
	    (setq ptlst (reverse ptlst))
	    (setq ptlst (cons pstart ptlst))
	    (setq leptlst (length ptlst))
	    (setq leptlst (- leptlst 1))
	    (setq x0 (car (nth leptlst ptlst)))
	    (setq y0 (cadr (nth leptlst ptlst)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	    (setq m1 (sin (- (/ ar 2) u)))
	    (setq m2 (cos (- (/ ar 2) u)))
	    (setq m0 (/ m1 m2))
	    (setq m (* (* r0 m0) (cos u)))
	    (setq m3 (sin (/ ar 2)))
	    (setq m4 (cos (/ ar 2)))
	    (setq b1 (/ m3 m4))
	    (setq b (* y0 b1))
	    (setq c (* (* (* r0 (sin u)) b1) m0))
	    (setq s (+ (+ (+ x0 m) b) c))
	    (setq st1 (polar pc ang1 s))
	    (setq st2 (polar pc ang2 s))
	    ;(setvar "osmode" 0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	    (command "layer" "m" "www.cehui.ren T-s" "c" "7" "" "L" "continuous" "" "LO" "www.cehui.ren T-s" "" "")
	    (command "layer" "s" "www.cehui.ren T-s" "")
	    (command "point" (list (car st1) (cadr st1)))
	    (command "circle" st1 (* 0.25 txth))
;;;;;;;;;;;;;;;;
	    (command "point" (list (car st2) (cadr st2)))
	    (command "circle" st2 (* 0.25 txth))
	    (setq st3 (polar st1 (+ ang1 (/ pi 2)) 100))
	    (setq st4 (polar st2 (+ ang2 (* 0.5 pi)) 100))
	    (setq ps (inters st1 st3 st2 st4 nil))

	    (command "ucs" "New" "3p" st1 pc ps)
	    (command "layer" "m" "www.cehui.ren S-C" "c" "7" "" "L" "continuous" "" "LO" "www.cehui.ren S-C" "" "")
	    (command "layer" "s" "www.cehui.ren S-c" "")
	    (command "point" (list x0 y0))
	    (command "circle" (list x0 y0) (* 0.25 txth))
;;;;;;;;;;;;;
	    (command "layer" "m" "www.cehui.ren line" "c" "red" "" "L" "continuous" "" "LW" 0.30 "" "")
	    (command "layer" "s" "www.cehui.ren line" "")
	    (command "color" "bylayer")
	    ;(setvar "osmode" 0)
	    (command "__.spline")
	    ;(setvar "osmode" 0)
	    (mapcar 'command ptlst)
	    (command "" "" "")
;;;;;;;;;;;;;;;;;;;;;;
	    (command "ucs" "world")
	    (setvar "clayer" clyr)
	    (command "ucs" "New" "3p" st2 pc ps)
	    (command "layer" "m" "www.cehui.ren C-S" "c" "7" "" "L" "continuous" "" "LO" "www.cehui.ren C-S" "" "")
	    (command "layer" "s" "www.cehui.ren C-S" "")
	    (command "point" (list x0 y0))
	    (command "circle" (list x0 y0) (* 0.25 txth))
	    (setvar "clayer" clyr)
	    (command "layer" "m" "www.cehui.ren line" "c" "red" "" "L" "continuous" "" "LW" 0.30 "" "")
	    (command "layer" "s" "www.cehui.ren line" "")
	    (command "color" "bylayer")
	    ;(setvar "osmode" 0)
	    (command "__.spline")
	    (mapcar 'command ptlst)
	    ;(setvar "osmode" 0)
	    (command "" "" "")
	    (command "ucs" "world")
	    (setq ang3 (angle pc ps)
		  ang4 (- pi ar)
		  w    (atan y0 (- s x0))
		  q    (- (/ ang4 2) w)
		  )
	    (if	(zerop q)
		(print "no curve")
		(progn
		    (setq z   (sqrt (+ (expt (- s x0) 2) (expt y0 2)))
			  pm1 (polar pc (+ ang3 q) z)
			  pm2 (polar pc (- ang3 q) z)
			  )
;;;;;;;;;;;;;;;;;;;;;;;;;;;txt

;;;;;;;;;;;;;;;;;;;;;;;;;;;;txt
		    )
		)
	    (command "layer" "m" "www.cehui.ren arc"	"c" "green" "" "L" "continuous"	"" "LW"	0.30 ""	"")
	    (command "layer" "s" "www.cehui.ren arc" "")
	    (command "color" "bylayer")
	    (cond ((and	(<= (abs (- (car pm1) (car pm2))) 0.001)
			(<= (abs (- (cadr pm1) (cadr pm2))) 0.001)
			)
		   (progn
		       (setq lc 0)
		       (setq angcg 0)
		       )
		   )
		  (t
		   (command "arc"
			    (list (car pm1) (cadr pm1))
			    "e"
			    (list (car pm2) (cadr pm2))
			    "radius"
			    r0
			    )
		   )
		  )

	    (setq angc (- ar (* 2 u)))
	    (setq angcg (/ (* angc 180) pi));200->180
	    (setq lc (* angc r0))
	    (setq tx (polar pc 0 6))
	    ;(setvar "osmode" 0) ;QinDong
	    (command "color" 6)
	    (command "layer" "m" "www.cehui.ren data" "c" "magenta" "" "L" "continuous" "" "LW" 0.15	""
		     "")
	    (command "layer" "s" "www.cehui.ren data" "")
	    (command "color" "bylayer")
	    (command "text"
		     (polar pc 1.5708 6)
		     txth
		     90
		     (strcat "a=" (rtos a 2 4) "^")
		     )
	    (command "text" "" (strcat "ls=" (rtos l0 2 3)))
	    (command "text" "" (strcat "R0=" (rtos r0 2 2)))
	    (command "text" "" (strcat "x0=" (rtos x0 2 3)))
	    (command "text" "" (strcat "y0=" (rtos y0 2 3)))
	    (command "text" "" (strcat "s=" (rtos s 2 3)))
    ;(setq vm (/ (* v 200)pi))
	    (command "text" "" (strcat "T0=" (rtos t0 2 3)))
	    (command "text" "" (strcat "Ac=" (rtos angcg 2 4)))
	    (command "text" "" (strcat "Lc=" (rtos lc 2 3)))
	    (setq v (expt (/ (* l0 r0) 0.042849) 0.333333333333))
	    (alert (strcat " 该缓和曲线上的速度不大于 ="
			   (rtos v 2 0)
			   "Km/h"
			   )
		   )
	    (setvar "clayer" clyr)
	    ;(setvar "osmode" 0) ;QinDong
    ;(setvar "osmode" osmd)
    ;(command "._undo" "_END")
	    )

	(progn
	    (setq pc1 (getpoint "\n 请拾取平曲线上第1点(HY)")
		  pc2 (getpoint "\n 请拾取平曲线上第2点(QZ)")
		  pc3 (getpoint "\n 请拾取平曲线上第3点(YH)")
		  )
	    (setq obm (getvar "blipmode"))
	    (setq osmd (getvar "osmode"))
	    (setvar "osmode" 0)
	    (setq andr (getvar "angdir"))

	    (setvar "angdir" 1)
	    (setq andb (getvar "angbase"))
	    (setvar "angbase" (/ pi 2))
	    (setq aunt (getvar "aunits"))
	    (setvar "aunits" 0)
	    (setvar "dimaunit" 1)
	    (setvar "dimadec" 4)
	    (setq G  (/ (+ (car pc1) (car pc2)) 2)
		  H  (/ (+ (cadr pc1) (cadr pc2)) 2)
		  I  (/ (+ (car pc1) (car pc3)) 2)
		  J  (/ (+ (cadr pc1) (cadr pc3)) 2)
		  M  (- (car pc2) (car pc1))
		  N  (- (cadr pc2) (cadr pc1))
		  O  (- (car pc3) (car pc1))
		  p  (- (cadr pc3) (cadr pc1))
		  A1 (* (* O M) I)
		  A2 (* (* p M) J)
		  A3 (* (* O M) G)
		  A4 (* (* O N) H)
		  A5 (- (* M p) (* O N))
		  )
	    (setq A (- (- (+ A1 A2) A3) A4))
	    (setq Yc (/ A A5))
	    (setq Xc (/ (+ (- (* G M) (* N YC)) (* N H)) M))
	    (setq cc (list xc yc))
	    (setq r0 (sqrt
			 (+ (expt (- xc (car pc1)) 2) (expt (- yc (cadr pc1)) 2))
			 )
		  )
	    (setq p1 (getpoint
			 "\n 请拾取直线段与缓和曲线连接点ZH点(直缓点):")
		  p2 (getpoint "\n 请拾取直线段上第2点(远端点):")
		  )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	    (cond
		((= (cadr p1) (cadr p2))
		 (progn
		     (setq x xc)
		     (setq y (cadr p1))
		     (setq Dl (abs (- yc y)))
		     (setq D (- dl r0))
		     )
		 )
		((= (car p1) (car p2))
		 (progn
		     (setq x (car p1))
		     (setq y yc)
		     (setq Dl (sqrt (+ (expt (- xc x) 2) (expt (- yc y) 2))))
		     (setq D (- dl r0))
		     )
		 )
		(t
		 (setq m1 (* (* (car p1) (cadr p2)) (- (cadr p2) (cadr p1)))
		       m2 (* (* (car p2) (cadr p1)) (- (cadr p2) (cadr p1)))
		       m3 (* xc (expt (- (car p1) (car p2)) 2))
		       m4 (* (* (- (car p1) (car p2)) (- (cadr p2) (cadr p1))) yc)
		       m5 (+ (expt (- (cadr p2) (cadr p1)) 2)
			     (expt (- (car p1) (car p2)) 2)
			     )
		       m  (- (+ (- m1 m2) m3) m4)
		       x  (/ m m5)
		       t1 (* x (- (car p1) (car p2)))
		       t2 (* yc (- (cadr p2) (cadr p1)))
		       t3 (* xc (- (car p1) (car p2)))
		       t4 (- (cadr p2) (cadr p1))
		       y  (/ (- (+ t1 t2) t3) t4)
		       ta (list x y)
		       )
		 (setq Dl (sqrt (+ (expt (- xc x) 2) (expt (- yc y) 2))))
		 (setq D (- dl r0))
		 )
		)

	    (setq m   (expt (* 24 d r0) 0.5)
		  w   (/ m (* 2 r0))
		  i1  (sqrt (* m (* 2 r0)))
		  w7  (/ (expt w 1.5) 3)
		  w8  (/ (expt w 3.5) 42)
		  w9  (/ (expt w 5.5) 1320)
		  w10 (/ (expt w 7.5) 80640)
		  w11 (/ (expt w 9.5) 6894720)
		  z   (* i1 (+ (- (+ (- w7 w8) w9) w10) w11))
		  e1  (* r0 (- 1 (cos w)))
		  e   (- z e1)
		  n   (+ 0.2 m)
		  u   (/ n (* 2 r0))
		  i2  (sqrt (* n (* 2 r0)))
		  u7  (/ (expt u 1.5) 3)
		  u8  (/ (expt u 3.5) 42)
		  u9  (/ (expt u 5.5) 1320)
		  u10 (/ (expt u 7.5) 80640)
		  u11 (/ (expt u 9.5) 6894720)
		  y2  (* i2 (+ (- (+ (- u7 u8) u9) u10) u11))
		  f   (- y2 (* r0 (- 1 (cos u))))
		  )
	    (setq l0 (/ (+ (* m (- f d)) (* n (- d e))) (- f e)))
	    (setq clyr (getvar "clayer"))
	    (setq u (/ l0 (* 2 r0)))
	    (setq t0 (/ (* 180 u) pi));200->180 QinDong
	    (princ "T0=")
	    (princ t0)
	    (setq i (sqrt (* 2 (* l0 r0))))
	    (setq u1  (expt u 0.5)
		  u2  (/ (expt u 2.5) 10)
		  u3  (/ (expt u 4.5) 216)
		  u4  (/ (expt u 6.5) 9360)
		  u5  (/ (expt u 8.5) 685440)
		  u6  (/ (expt u 10.5) 76204800)
		  u7  (/ (expt u 1.5) 3)
		  u8  (/ (expt u 3.5) 42)
		  u9  (/ (expt u 5.5) 1320)
		  u10 (/ (expt u 7.5) 80640)
		  u11 (/ (expt u 9.5) 6894720)
		  )
	    (setq x0 (* i (- (+ (- (+ (- u1 u2) u3) u4) u5) u6)))
	    (setq y0 (* i (+ (- (+ (- u7 u8) u9) u10) u11))
		  )
	    (initget "R L")
	    (setq q (getkword "\n 请选择缓和曲线转弯方向(L为左/R为右，直接回车为R):<R>"))
	    (if	(= q "L")
		(progn
		    (setq ang6 (angle (list xc yc) (list x y))
			  c1   (polar (list xc yc) (+ ang6 u) r0)
			  c2   (polar c1 ang6 y0)
			  cb   (polar c2 (- ang6 (/ pi 2)) x0)
			  cb1  (polar cb (- ang6 pi) 180);200->180 QinDong
			  )
		    ;(setvar "osmode" 0) ;QinDong
		    (command "layer" "m" "www.cehui.ren ENDS-START" "c" "7" "" "L" "continuous" "" "LO"
			     "ENDS-START" "" "")
		    (command "layer" "s" "www.cehui.ren ENDS-START" "")
		    (command "point" (list (car c1) (cadr c1)))
		    (command ".circle" c1 (* 0.25 txth))
		    (command "point" (list (car c2) (cadr c2)))

		    (command "point" (list (car cb) (cadr cb)))
		    (command ".circle" cb (* 0.25 txth))
		    (setvar "clayer" clyr)
		    (command "ucs" "new" "3p" cb c2 cb1)
		    (setq k 1)
		    (setq sn 1
			  n0 (/ l0 sn)
			  )
		    (while (<= k n0)
			(progn
			    (setq ln (* k sn)
				  i  (sqrt (* 2 (* l0 r0)))
				  )
			    (setq v (/ (expt ln 2) (expt i 2)))
			    (setq v1  (expt v 0.5)
				  v2  (/ (expt v 2.5) 10)
				  v3  (/ (expt v 4.5) 216)
				  v4  (/ (expt v 6.5) 9360)
				  v5  (/ (expt v 8.5) 685440)
				  v6  (/ (expt v 10.5) 76204800)
				  v7  (/ (expt v 1.5) 3)
				  v8  (/ (expt v 3.5) 42)
				  v9  (/ (expt v 5.5) 1320)
				  v10 (/ (expt v 7.5) 80640)
				  v11 (/ (expt v 9.5) 6894720)
				  )
			    (setq xn (* i (- (+ (- (+ (- v1 v2) v3) v4) v5) v6)))
			    (setq yn (* i (+ (- (+ (- v7 v8) v9) v10) v11)))
			    (command "color" 1)

			    (if	(= k 1)
				(progn
				    (setq brx (list xn)
					  bry (list yn)
					  ldn (list ln)
					  t0x (list v)
					  )
				    )
				(progn
				    (setq brx (append brx (list xn))
					  bry (append bry (list yn))
					  ldn (append ldn (list ln))
					  t0x (append t0x (list v))
					  )
				    )
				)
			    (setq k (+ 1 k))
			    )
			?
			)
		    ?
		    (setq brx (append (list 0) brx))
		    (setq bry (append (list 0) bry))
		    (setq lbrx (length brx))
		    (setq lbry (length bry))
		    ;(setvar "osmode" 0) ;QinDong
		    (command "spline"
			     (list (nth 0 brx) (nth 0 bry))
			     (list (nth (fix (* 0.05 lbrx)) brx)
				   (nth (fix (* 0.05 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.1 lbrx)) brx)
				   (nth (fix (* 0.1 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.15 lbrx)) brx)
				   (nth (fix (* 0.15 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.2 lbrx)) brx)
				   (nth (fix (* 0.2 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.25 lbrx)) brx)
				   (nth (fix (* 0.25 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.3 lbrx)) brx)
				   (nth (fix (* 0.3 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.35 lbrx)) brx)
				   (nth (fix (* 0.35 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.4 lbrx)) brx)
				   (nth (fix (* 0.4 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.45 lbrx)) brx)
				   (nth (fix (* 0.45 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.5 lbrx)) brx)
				   (nth (fix (* 0.5 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.55 lbrx)) brx)
				   (nth (fix (* 0.55 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.6 lbrx)) brx)
				   (nth (fix (* 0.6 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.65 lbrx)) brx)
				   (nth (fix (* 0.65 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.7 lbrx)) brx)
				   (nth (fix (* 0.7 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.75 lbrx)) brx)
				   (nth (fix (* 0.75 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.8 lbrx)) brx)
				   (nth (fix (* 0.8 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.85 lbrx)) brx)
				   (nth (fix (* 0.85 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.9 lbrx)) brx)
				   (nth (fix (* 0.9 lbrx)) bry)
				   )
			     (list (nth (fix (* 0.95 lbrx)) brx)
				   (nth (fix (* 0.95 lbrx)) bry)
				   )
			     (list x0 y0)
			     ""
			     ""
			     ""
			     )
		    ;(setvar "osmode" 0) ;QinDong
		    (command "ucs" "world")
		    (setq tx (polar (list xc yc) 0 6))
		    (command "text"
			     (polar (list xc yc) 1.5708 3)
			     txth
			     90
			     (strcat "D=" (rtos d 2 3))
			     )

		    (command "text" "" (strcat "ls=" (rtos l0 2 3)))

		    (command "text" "" (strcat "R0=" (rtos r0 2 2)))

		    (command "text" "" (strcat "x0=" (rtos x0 2 3)))

		    (command "text" "" (strcat "y0=" (rtos y0 2 3)))

		    (setq vf (/ l0 (* 2 r0)))
		    (setq vr (/ (* vf 180) pi));200->180 QinDong
		    (command "text" "" (strcat "T0=" (rtos vr 2 3)))
		    (setq v (expt (/ (* l0 r0) 0.042849) 0.333333333333))
		    ;(alert
			;(strcat "该缓和曲线速度不得大于 " (rtos v 2 0) "Km/h")
			;)
		    (setq speed (expt (/ (* l0 r0) 0.042849) 0.3333333333333333))

    ;(command "._undo" "_END")
;;;;;;;;;;;;;;;;;;mmmmmmmmmmmmmmuuuuuuuuuuuuuuuuuu
		    ;(setvar "osmode" 0) ;QinDong
    ;(setvar "osmode" osmd)
		    (setvar "angbase" andb)
		    (setvar "angdir" andr)
		    (setvar "aunits" aunt)
		    )
		(progn ?
		       (setq ang6 (angle (list xc yc) (list x y))
			     c1	  (polar (list xc yc) (- ang6 u) r0)
			     c2	  (polar c1 ang6 y0)
			     cb	  (polar c2 (+ ang6 (/ pi 2)) x0)
			     cb1  (polar cb (- ang6 pi) 180);200->180 QinDong
			     )
		       (command	"layer"	"m" "www.cehui.ren ENDS-START" "c" "7" "" "L"	"continuous" ""	"LO"
				"ENDS-START" ""	"")
		       (command "layer" "s" "www.cehui.ren ENDS-START" "")
		       (command "point" (list (car c1) (cadr c1)))
		       (command ".circle" c1 (* 0.25 txth))
		       (command "point" (list (car c2) (cadr c2)))
		       (command "point" (list (car cb) (cadr cb)))
		       (command ".circle" cb (* 0.25 txth))
		       (setvar "clayer" clyr)
		       (command "ucs" "new" "3p" cb c2 cb1)
		       (setq k 1)
		       (setq sn	1
			     n0	(/ l0 sn)
			     )
		       (while (<= k n0)
			   (progn
			       (setq ln	(* k sn)
				     i	(sqrt (* 2 (* l0 r0)))
				     )
			       (setq v (/ (expt ln 2) (expt i 2)))
			       (setq v1	 (expt v 0.5)
				     v2	 (/ (expt v 2.5) 10)
				     v3	 (/ (expt v 4.5) 216)
				     v4	 (/ (expt v 6.5) 9360)
				     v5	 (/ (expt v 8.5) 685440)
				     v6	 (/ (expt v 10.5) 76204800)
				     v7	 (/ (expt v 1.5) 3)
				     v8	 (/ (expt v 3.5) 42)
				     v9	 (/ (expt v 5.5) 1320)
				     v10 (/ (expt v 7.5) 80640)
				     v11 (/ (expt v 9.5) 6894720)
				     )
			       (setq xn (* i (- (+ (- (+ (- v1 v2) v3) v4) v5) v6)))
			       (setq yn (* i (+ (- (+ (- v7 v8) v9) v10) v11)))
			       (command "color" 1)

			       (if (= k 1)
				   (progn
				       (setq brx (list xn)
					     bry (list yn)
					     ldn (list ln)
					     t0x (list v)
					     )
				       )
				   (progn
				       (setq brx (append brx (list xn))
					     bry (append bry (list yn))
					     ldn (append ldn (list ln))
					     t0x (append t0x (list v))
					     )
				       )
				   ) ;endif
			       (setq k (+ 1 k))
			       ) ;end progn?
			   ) ;end while
		       (setq brx (append (list 0) brx))
		       (setq bry (append (list 0) bry))
		       (setq lbrx (length brx))
		       (setq lbry (length bry))
		       ;(setvar "osmode" 0) ;QinDong
		       (command	"spline"
				(list (nth 0 brx) (nth 0 bry))
				(list (nth (fix (* 0.05 lbrx)) brx)
				      (nth (fix (* 0.05 lbrx)) bry)
				      )
				(list (nth (fix (* 0.1 lbrx)) brx)
				      (nth (fix (* 0.1 lbrx)) bry)
				      )
				(list (nth (fix (* 0.15 lbrx)) brx)
				      (nth (fix (* 0.15 lbrx)) bry)
				      )
				(list (nth (fix (* 0.2 lbrx)) brx)
				      (nth (fix (* 0.2 lbrx)) bry)
				      )
				(list (nth (fix (* 0.25 lbrx)) brx)
				      (nth (fix (* 0.25 lbrx)) bry)
				      )
				(list (nth (fix (* 0.3 lbrx)) brx)
				      (nth (fix (* 0.3 lbrx)) bry)
				      )
				(list (nth (fix (* 0.35 lbrx)) brx)
				      (nth (fix (* 0.35 lbrx)) bry)
				      )
				(list (nth (fix (* 0.4 lbrx)) brx)
				      (nth (fix (* 0.4 lbrx)) bry)
				      )
				(list (nth (fix (* 0.45 lbrx)) brx)
				      (nth (fix (* 0.45 lbrx)) bry)
				      )
				(list (nth (fix (* 0.5 lbrx)) brx)
				      (nth (fix (* 0.5 lbrx)) bry)
				      )
				(list (nth (fix (* 0.55 lbrx)) brx)
				      (nth (fix (* 0.55 lbrx)) bry)
				      )
				(list (nth (fix (* 0.6 lbrx)) brx)
				      (nth (fix (* 0.6 lbrx)) bry)
				      )
				(list (nth (fix (* 0.65 lbrx)) brx)
				      (nth (fix (* 0.65 lbrx)) bry)
				      )
				(list (nth (fix (* 0.7 lbrx)) brx)
				      (nth (fix (* 0.7 lbrx)) bry)
				      )
				(list (nth (fix (* 0.75 lbrx)) brx)
				      (nth (fix (* 0.75 lbrx)) bry)
				      )
				(list (nth (fix (* 0.8 lbrx)) brx)
				      (nth (fix (* 0.8 lbrx)) bry)
				      )
				(list (nth (fix (* 0.85 lbrx)) brx)
				      (nth (fix (* 0.85 lbrx)) bry)
				      )
				(list (nth (fix (* 0.9 lbrx)) brx)
				      (nth (fix (* 0.9 lbrx)) bry)
				      )
				(list (nth (fix (* 0.95 lbrx)) brx)
				      (nth (fix (* 0.95 lbrx)) bry)
				      )
				(list x0 y0)
				""
				""
				""
				)
		       (setq vc (/ l0 (* 2 r0)))
		       (setq vx (/ (* vc 180) pi));200->180 QinDong
		       (command "ucs" "world")
		       (setq tx (polar (list xc yc) 0 6))

		       (command	"text"
				(polar (list xc yc) 1.5708 3)
				txth
				90
				(strcat "D=" (rtos d 2 3))
				)

		       (command "text" "" (strcat "ls=" (rtos l0 2 3)))

		       (command "text" "" (strcat "R0=" (rtos r0 2 2)))

		       (command "text" "" (strcat "x0=" (rtos x0 2 3)))

		       (command "text" "" (strcat "y0=" (rtos y0 2 3)))
		       (command "text" "" (strcat "T0=" (rtos vx 2 3)))
		       (setq v (expt (/ (* l0 r0) 0.042849) 0.333333333333))
		       ;(alert
			;   (strcat "缓和曲线上的速度不得超过 " (rtos v 2 0) "Km/h")
			;   )
    ;(command "._undo" "_END")
		       (setvar "osmode" osmd)
		       (setvar "angbase" andb)
		       (setvar "angdir" andr)
		       (setvar "aunits" aunt)

		       )
		)
	    )
	)
    (setvar "osmode" osmd)
    (setvar "angbase" andb)
    (setvar "angdir" andr)
    (setvar "aunits" aunt)
    (princ
	"\n 缓和曲线绘制程序  微博\\抖音\\CSDN：测量老覃   [www.cehui.ren]   qinxyz@email.cn")
    (princ)
    )